package tds.model19.version1;
/**
 * @Company 杭州先锋电子技术股份有限公司
 * @ClassName Originator
 * @Description 发起人类（需要备份数据的类）
 * @author tds
 * @Date 2020/2/4 17:18
 * @version 1.0.0
 */
public class Originator {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    /**
     * @Description 创建备忘录
     * @param
     * @return tds.model19.version1.Memento
     */
    public Memento createMemento(){
        return new Memento(this.state);
    }

    /**
     * @Description 恢复备份数据
     * @param memento
     * @return void
     */
    public void setMemento(Memento memento){
        this.state = memento.getState();
    }

    public void show(){
        System.out.println("当前状态为：" + state);
    }
}
